package com.cc.service.impl;

import com.cc.entity.Dormitory;
import com.cc.mapper.DormitoryMapper;
import com.cc.mapper.StudentMapper;
import com.cc.service.DormitoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class DormitoryServiceImpl implements DormitoryService {
    @Autowired
    private DormitoryMapper dormitoryMapper;
    @Transactional
    @Override
    public List<Dormitory> selectAllDormitories() {
        return dormitoryMapper.selectAllDormitories();
    }
    @Transactional
    @Override
    public Dormitory selectDormitoryById(Long id) {
        return dormitoryMapper.selectDormitoryById(id);
    }
    @Transactional
    @Override
    public boolean insertDormitory(Dormitory dormitory) {
        return dormitoryMapper.insertDormitory(dormitory)>0;
    }
    @Transactional
    @Override
    public boolean updateDormitory(Dormitory dormitory,Long id) {
        return dormitoryMapper.updateDormitory(dormitory,id)>0;
    }
    @Transactional
    @Override
    public boolean deleteDormitory(Long id) {
        return dormitoryMapper.deleteDormitory(id)>0;
    }
}
